import HomeLayout from '@/layouts/HomeLayout.vue';

export default [
  {
    path: '/',
    redirect: '/login',
    component: HomeLayout,
    children: [
      {
        path: '/login',
        name: 'LoginRouter',
        beforeEnter: async (to, from, next) => {
          console.log(to, from, next);
          const token = localStorage.getItem('token');
          if (!token) {
            next();
          } else {
            next({ path: '/upload' });
          }
        },
        component: () => import('@/pages/auth/Login.vue'),
      },
    ],
  },
];
